﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Windows.Forms;
using com.lover.astd.common.config;

namespace com.lover.astd.game.ui
{
    static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main(string[] args)
        {
            //if ((args.Length < 1 || args[0] != "from_updater") && !GlobalConfig.getInstance().IsDebug)
            //{
            //    MessageBox.Show("请运行updater.exe", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            //    Environment.Exit(1);
            //}
            // check if any updater1.exe, if exists, delete updater.exe, rename updater1.exe to updater.exe
            string former_file = "updater1.exe", target_file = "updater.exe";
            if (File.Exists(former_file))
            {
                if (File.Exists(target_file)) File.Delete(target_file);
                File.Move(former_file, target_file);
            }

            //bool otherInstance = false;
            //Mutex mutex = new Mutex(true, "pokersc", out otherInstance);
            //if (!otherInstance)
            //{
            //    MessageBox.Show("本程序只能运行一个实例, 即将退出", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            //    System.Threading.Thread.Sleep(5000);
            //    Environment.Exit(1);
            //}

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new MainForm());
        }
    }
}
